package com.yang.provider.controller;

import com.yang.provider.entity.User;
import com.yang.provider.service.UserService;
import com.yang.common.dto.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ：YangRan
 * @date ：Created in 2021/10/31 17:03
 * @description：登录
 * @modified By：
 * @version: 1.0
 */

@RestController
@Slf4j
@RequestMapping(value = "login")
public class LoginController {

    @Autowired
    private UserService userService;



    @PostMapping("/userLogin")
    public ResultVO validUser(@RequestBody User user) {
        return userService.login(user);
    }

    @PostMapping("/userLogout")
    public ResultVO logout(HttpServletRequest request) {
        return userService.logout(request);
    }






}
